package com.ewanghuiju.app.ui.home.adapter;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.model.bean.local.SearchLikeBean;

/**
 * @author sj  qq:751943509
 * @class 搜索 热门推荐
 * @time 2020/2/20
 */
public class SearchLikeAdapter extends BaseQuickAdapter<SearchLikeBean, BaseViewHolder> {
    public SearchLikeAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchLikeBean item) {

        helper.setText(R.id.tv_title, item.getTitle());
        helper.setText(R.id.tv_now_price, item.getNow_price());
        helper.setText(R.id.tv_yhq, item.getQuan_price()+"元券");
        helper.setText(R.id.tv_buynum, item.getNumber()+"人正抢购");
        TextView tv_yuan = helper.getView(R.id.tv_yuan_price);
        tv_yuan.setText("￥"+item.getYuan_price());
        tv_yuan.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰
        ImageView iv = helper.getView(R.id.riv_shop_img);
        Glide.with(mContext).load(item.getImage()).into(iv);
    }
}
